package no15;

/**
 * 泛型的例子
 * 
 * @author gao
 * 
 * @param <T>
 */
public class Holder3<T> {
	private T a;

	public T getA() {
		return a;
	}

	public void setA(T a) {
		this.a = a;
	}

	public static void main(String[] args) {
		Holder3<String> holder = new Holder3<String>();
		holder.setA("a");
		System.out.println(holder.getA());
	}

}

class Holder2<A, B> {
	private A a;
	private B b;
	public B getB() {return b;}
	public void setB(B b) {this.b = b;}
	public A getA() {return a;}
	public void setA(A a) {this.a = a;}
	public static void main(String[] args) {
		Holder2<String,Integer> holder = new Holder2<String,Integer>();
		holder.setA("a");
		holder.setB(1);
		System.out.println(holder.getA());
		System.out.println(holder.getB());
	}
}
